var types = ['default','primary','warn']
var pageObject = {
    data: {
        defaultSize: 'default',
        primarySize: 'default',
        warnSize: 'default',
        disabled: false,
        plain: false,
        loading: false
    },
    setDisabled: function (e) {
        this.setData({
            disabled: !this.data.disabled
        })
    },
    setPlain: function (e) {
        this.setData({
            plain: !this.data.plain
        })
    },
    setLoading: function (e) {
        this.setData({
            loading: !this.data.loading
        })
    },
    getPhoneNumber: function (info) {
        console.log(info);
    },
    getInfo(e) {
        console.log(e);
    },
    getContactInfo(e) {
        console.log(e);
    }
}
for(var i =0; i<types.length;i++){
    (function (type) {
       pageObject[type] = function (e) {
           var key = type + 'Size'
           var changedData = {}
           changedData[key] = this.data[key] === 'default' ? 'mini' : 'default'
           this.setData(changedData)
       } 
    })(types[i])
}
Page(pageObject)